<?php

namespace App\Services\Permission;

use App\Dao\Permission\MenuDao;
use App\Extends\BaseService;

class MenuService extends BaseService
{
    public function __construct(MenuDao $dao)
    {
        parent::__construct($dao);
        $this->dao = $dao;
    }

    /**
     * 获取菜单权限树形结构列表
     * @return array
     */
    public function getMenuTreeList(): array
    {
        $all = $this->dao->all('sort', 'asc')->toArray();
        return build_tree($all);
    }
}
